package belf.migrate.api.table.schema;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;

/**
 * 表示表中字段带有的CHECK约束条件
 */
@Data
@AllArgsConstructor
public class CheckConstraint implements Serializable {
    private static final long serialVersionUID = 11L;
    /** 约束对应的表，仅仅用于打印展示，构建约束条件时用不到 */
    private final String table;
    /** 约束名称 */
    private final String constraintName;
    /** 约束条件 */
    private final String condition;
    /** 约束作用的字段 */
    private String column;
    /** 在删除记录时对应字段的值怎么处理？CASCADE,SET NULL或NO ACTION */
    private String deleteRule;

    public CheckConstraint(String table, String constraintName, String condition) {
        this.table = table;
        this.constraintName = constraintName;
        this.condition = condition;
    }
}
